#ifndef EZSAMPLE_H
#define EZSAMPLE_H

#include <QtWidgets/QMainWindow>
#include <QTime>
//#include "curshare.h"
#include "../bin/CamApi.h"
//class CamView;
class RawDecoder;
namespace Ui {
class CameraControl;
}

class CameraControl : public QMainWindow
{
    Q_OBJECT

public:
    explicit CameraControl(QWidget *parent = nullptr);
    ~CameraControl();

private:
    Ui::CameraControl *ui;
    struct _DESCRIPTOR desc;
    QTime timeStart;
    // exposure
    double curSec, curMS;
    int rate;

    QString m_fileNamePrefix;
    int *handleRecord;
    char imagePath[128];

    bool snap = false;
    void *hAvi = nullptr;

    uchar *recvBuf = nullptr; // proess buffer
    uchar *showBuf = nullptr;    // display buffer

    int fpsCounts = 0;
    bool isStop;
private:
    void InitGUI();
    void Decode();
    void ROI256();
    void InitData();
    void DeleteData();
    void UpExposure(float curTime);
    void ImageShow();
    void fpsShow();

private slots:
    void on_cboxRes_currentIndexChanged(int index);
    void on_btnLive_clicked();

//    void on_hSliderBklvl_valueChanged(int value);
    void on_btnSnap_clicked();
    void on_hSliderGamma_valueChanged(int value);
    void on_hSliderContrast_valueChanged(int value);
//    void on_chcHFlip_clicked(bool checked);
//    void on_chcVFlip_clicked(bool checked);
//    void on_chcTFlip_clicked(bool checked);

    void on_spinBoxSec_valueChanged(int arg1);
    void on_doubleSpinBoxMS_valueChanged(double arg1);

    void on_btnApply_clicked();
    void on_chkAE_clicked(bool checked);

    void on_autolevel_clicked(bool checked);

    void on_btnROI_clicked();
    void on_cboxGain_currentIndexChanged(int index);
    void on_btnVideo_clicked();
};

#endif // EZSAMPLE_H
